<template>
  <div>
    <el-row>
      <el-col>
        <el-form :inline="true" :model="formInline">
          <el-form-item>
            <el-input size="mini" v-model="formInline.user" placeholder="请输入设备编号"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input size="mini" v-model="formInline.user" placeholder="请输入设备名称"></el-input>
          </el-form-item>
          <el-form-item>
            <el-select clearable size="mini" v-model="formInline.region" placeholder="请选择状态">
              <el-option label="出借" value="shanghai"></el-option>
              <el-option label="正常" value="beijing"></el-option>
              <el-option label="损坏" value="beijing2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" size="mini">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-row class="buttonList">
      <el-col>
        <el-button type="danger" size="small" @click="dialogFormVisible = true">报废</el-button>
      </el-col>
    </el-row>
    <el-row>
      <!--<el-col :span="4">
        <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
      </el-col>-->
      <el-col :span="24">
        <el-table
          :data="tableData"
          size="mini"
          border
          style="width: 100%">
          <el-table-column
                  align="center"
                  type="selection"
                  width="55">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="设备编号">
          </el-table-column>
          <el-table-column
            align="center"
            prop="email"
            label="设备名称">
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            label="放置地">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status"
            label="贵重仪器">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="低值易耗品">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="仪器分类">
          </el-table-column>
          <el-table-column
            align="center"
            prop="createUser"
            label="入库日期">
          </el-table-column>
        </el-table>
        <el-pagination
                background
                layout="total, sizes, prev, pager, next, jumper"
                :page-size="pagination.pageSize"
                :total="pagination.total"
                :page-sizes="[10, 20, 30, 50, 100]"
        >
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog title="设备报废登记" center :visible.sync="dialogFormVisible">
      <el-row>
        <el-col>
          <el-form :model="form" :label-width="formLabelWidth">
            <el-row>
              <el-col :span="12">
                <el-form-item label="设备名称">
                  <el-input size="mini" v-model="form.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="设备编号">
                  <el-input size="mini" v-model="form.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="申请人">
                  <el-input size="mini" v-model="form.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="报废日期">
                  <el-date-picker
                          size="mini"
                          v-model="form.value"
                          type="date"
                          placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="报废原因">
              <el-input size="mini" v-model="form.name" type="textarea"></el-input>
            </el-form-item>
            <el-form-item label="备注">
              <el-input size="mini" v-model="form.name" type="textarea"></el-input>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogFormVisible = false">取 消</el-button>
        <el-button size="mini" type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "scrapDisposal",
    data() {
      return{
        data: [{
          label: '同济科技职业学院',
          children: [{
            label: '校区1',
            children: [{
              label: '学院',
              children: [{
                label: "实训基地",
                children: [{
                  label: "实训室"
                }]
              }]
            }]
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        },
        pagination: {
          pageSize: 20,
          total: 1,
          pageNo: 1
        },
        fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
        dialogImageUrl: '',
        dialogVisible: false,
        form: {},
        dialogFormVisible: false,
        formLabelWidth: '120px',
        formInline: {},
        tableData: [{
          user: 'A01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: "正常"
        }, {
          user: 'A02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: '归档'
        }, {
          user: 'B01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: "正常"
        }, {
          user: 'B02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: '归档'
        }]
      }
    },
    methods: {
      handleNodeClick(data) {
        console.log(data);
      },
      //添加选项
      addSelect() {
        this.form2.deviceName.push({ name: "" });
      },
      delSelect(i) {
        this.form2.deviceName.splice(i, 1);
      },
    }
  }
</script>

<style scoped lang="scss">
  .search{
    margin-bottom: 10px;
  }
  /deep/.el-select{
    width: 100%;
  }
  .addDev {
    /deep/.el-form-item__content {
      display: flex;
    }
  }
  /deep/.el-divider{
    background: #409eff;
  }
  /deep/.el-divider__text{
    font-size: 18px;
    color: #409eff;
  }
  /deep/.el-date-editor.el-input, .el-date-editor.el-input__inner {
    width: 100%
  }
</style>
